<?php
namespace wogu2\mvc\action;

use ArrayObject;

class Action implements ActionInterface
{
    protected $_runtime = null;
    
    public function setRuntime(ArrayObject $runtime) {
        $this->_runtime = $runtime;
    }
    
    public function execute() {
        return self::SUCCESS;
    }
    
    protected function addHeader($header) {
        $this->_runtime->headers[] = $header;
    }
    
    protected function appendBody($body) {
        $this->_runtime->body[] = $body;
    }
    
    protected function set($key, $value) {
        $this->_runtime->valueStack[$key] = $value;
    }
    
    protected function clear($key) {
        unset($this->_runtime->valueStack[$key]);
    }
    
    protected function get($key, $default = null) {
        return isset($this->_runtime->valueStack[$key]) ? $this->_runtime->valueStack[$key] : $default;
    }
}